package com.vip.seata.at.account.controller;

import com.vip.seata.at.account.service.AccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/account")
public class AccountController {
    @Autowired
    AccountService accountService;

    //使用Seata
    @PostMapping("debit")
    public String debit(String userId, int money) {
        accountService.debit(userId, money);
        return "success";
    }

}
